using ViScript.Core;

namespace ViScript.Example
{
    public class ExampleLanguage
    {
        private readonly IOutput output;

        public ExampleLanguage(IOutput output)
        {
            this.output = output;
        }

        [Scriptable]
        public void user_login_with_password(string user, string password)
        {
            output.WriteLine(string.Format("{0} login with {1}", user, password));
        }

        [Scriptable]
        public void user_type_param(string user, string param)
        {
            output.WriteLine(string.Format("{0} type {1}", user, param));
        }

        [Scriptable]
        public void action_repeat_count_times(Clause action, int count)
        {
            while (count-- > 0)
            {
                action();
            }
        }
    }
}